#!/bin/csh
#Plot 2-D velocity and standard error by GMT from files anomaly.*.grd1 and stdde.*.grd1
 
#   cp ../../phase-coeff-*s.dat .
#    cp ../../nodecoeff* .  
#   set bds=-120/-106/22/35
#   set bds=-126/-108/29/41
#   set bds = -121/-110/32/40
#  set bds = -125/-110/31/40
  set bds = -125/-115/31/43
gmtset PLOT_DEGREE_FORMAT -D
#--------------------------velocity coefficients --------------------------
#makecpt -Ccopper -I -T2/7.0/.1 -Z >! crust.cpt
#makecpt -Crainbow -I -T3.6/4.0/.1 -Z >! anomaly1.cpt
makecpt -Cseis -T3.9/4.5/.1 -Z >! anomaly2.cpt
# makecpt -Crainbow -I -T-0.5/0.5/.1 -Z >! anomaly.cpt 

#***************************************
#foreach file (`ls phase-coeff-*s.dat`)
#set fn1=`echo $file | sed 's/.dat//' `
#xyz2grd -R$bds -I.5 $fn1.dat -G$fn1.grd2
#psbasemap -R$bds -JM5.5i -Ba2f2  -Y1.15 -K -P >! $fn1.ps
#grdimage $fn1.grd2 -R$bds -Canomaly.cpt -JM5.5i -Ba2f2 -K -O -P >> $fn1.ps
#grdcontour $fn1.grd2 -C.5 -JM5.5i -Ba2f2 -K -O -P >> $fn1.ps
#pscoast -R$bds -Dl -A250 -JM5.5i  -W1p -Na -K -O -P >> $fn1.ps
#psscale -D2.5i/7i/5.5i/.25ih -B0.2 -Canomaly.cpt -O -P >> $fn1.ps
#end
#rm *grd2 *~ anomaly.cpt 


#--------------------------velocity 0.2x0.2--------------------------

#./gridgen < phase-coeff-22s.dat > phasevel22s.dat
#./gridgen < phase-coeff-25s.dat > phasevel25s.dat
#./gridgen < phase-coeff-29s.dat > phasevel29s.dat
#./gridgen < phase-coeff-33s.dat > phasevel33s.dat
#./gridgen < phase-coeff-40s.dat > phasevel40s.dat
#./gridgen < phase-coeff-46s.dat > phasevel46s.dat
#./gridgen < phase-coeff-50s.dat > phasevel50s.dat
#./gridgen < phase-coeff-59s.dat > phasevel59s.dat
#./gridgen < phase-coeff-67s.dat > phasevel67s.dat
#./gridgen < phase-coeff-77s.dat > phasevel77s.dat
#./gridgen < phase-coeff-91s.dat > phasevel91s.dat
#./gridgen < phase-coeff-100s.dat > phasevel100s.dat
#./gridgen < phase-coeff-111s.dat > phasevel111s.dat
#./gridgen < phase-coeff-125s.dat > phasevel125s.dat
#./gridgen < phase-coeff-143s.dat > phasevel143s.dat

#./gridgen < nodecoeff10.80.16 > phasevel16s.dat

#makecpt -Crainbow -I -T3.6/4.3/.1 >! anomaly.cpt
  

#***************************************
#foreach file (`ls phasevel*s.dat`)
#foreach file (`ls vel_change*s.grd`)
#set fn1=`echo $file | sed 's/.grd//' `
#set fn1 = 'BRafter120.40.120.Brandon1_250'
set fn1 = 'anisoCmap.010.592.100.ncal'
set fn2 = 'c.010.592.100.ncal'
set fn3 = 'anisoCstd.010.592.100.ncal'
#xyz2grd -R$bds -I.25 $fn1 -G$fn1.grd2
surface -R$bds -I.25 $fn2 -G$fn2.grd2
#xyz2grd -R$bds -I.25 $fn1.grd -G$fn1.grd2
psbasemap -R$bds -JM5.5i -Ba2f2  -Y2.15 -K -P >! $fn1.ps
pstext -R$bds -JM5.5i -O -K -P -N <<EOI >> $fn1.ps
-120 41.5 12 0 0.5 5 $fn1
-121.5 27.5 14 0 0.5 5 Phase Velocity    km/s
EOI
psscale -D2.7i/-0.6i/5.5i/.25ih -B0.2 -Canomaly2.cpt -O -P -K >> $fn1.ps
psclip -R$bds -JM5.5i -O -K -P  <<EOI >> $fn1.ps
 -124.4 43.5
 -124.3 39.3
 -124.0 38.5
 -123.5 37.8
 -123.0 37.3
 -122.5 36.7
 -122.0 35.9
 -121.3 35.1
 -120.8 34.4
 -120.5 33.7
 -119.9 33.0
 -119.5 32.4
 -118.7 31.8
 -118.1 31.3
 -117.8 31.0
 -109.5 31.0
 -109.5 43.5
 -126.0 43.5
EOI
grdimage $fn2.grd2 -R$bds -Canomaly2.cpt -JM5.5i -Ba2f2 -K -O -P >> $fn1.ps
#grdcontour $fn1.grd2 -C.1 -JM5.5i -Ba2f2 -K -O -P >> $fn1.ps
#psxy BRrgnlBndryPts2.gmt -R$bds -JM5.5i -N -M -W2/0to -O -K -P >> $fn1.ps
#psxy SampleLoc3.dat -R$bds -JM5.5i -Sc0.1c -G0/0/0 -N -: -O -K -P >> $fn1.ps
#psxy YoungVolcPtsNear.txt -R$bds -JM5.5i -Sc0.2c -G0/0/255 -N -O -K -P >> $fn1.ps
#psxy NonVolcHistogram -R$bds -JM5.5i -Sc0.2c -G0/255/0 -N -O -K -P >> $fn1.ps
pscoast -R$bds -Dl -A250 -JM5.5i  -W1p -Na -K -O -P >> $fn1.ps
#psxy BRanisoafter120.40.120.smth_250 -R$bds -JM5.5i -W -SV0.03/0/0 -O -K -P >> $fn1.ps
pstext -R$bds -JM5.5i -O -K -P -N <<EOI >> $fn1.ps
-120 41.5 12 0 0.5 5 $fn1
#-121.8 36.7 12 0 1.5 5 C
#-116.4 36.5 12 0 1.5 5 C'
#-115.5 37.3 16 0 1.5 5 A
#-115.5 33.2 16 0 1.5 5 A'
#-119.6 36.6 16 0 1.5 5 B
#-115.0 36.6 16 0 1.5 5 B'
EOI
#psxy EW-118locs -R$bds -JM5.5i -N -W2p -P -O -K >> $fn1.ps
#psxy NS-116locs -R$bds -JM5.5i -N -W2p -P -O -K >> $fn1.ps
psxy $fn1 -R$bds -JM5.5i -W -SV0.03/0/0 -O -K -P >> $fn1.ps
psxy $fn3 -R$bds -JM5.5i -W -Sc -O -K -P >> $fn1.ps


#rm *grd2 *~ anomaly1.cpt 

gs $fn1.ps
